package com.condominio.dao;

import java.util.ArrayList;
import java.util.List;

import com.condominio.model.Conta;
import com.condominio.model.Pessoa;

/**
  *autor:Andre
  *data:07/05/2010
  *descricao:inicio do ContaDao
  *obs:versao incompleta.
  
*/
public class ContaDao extends GenericDao<Conta>{

	public ContaDao() {
		super();
	}
	
	@SuppressWarnings("unchecked")
	public List<Conta> getAllContasByPessoa (Pessoa u){
		return (List<Conta>)super.findAllByQuery("SELECT c FROM Conta c WHERE c.pessoa="+u);
	}
	
	@SuppressWarnings("unchecked")
	public List<Conta> findAllContas() {
		return super.findAllByQuery("SELECT c FROM Conta c ORDER BY c.id");
	}
	
	
	public Conta findContaById(Conta c){
		
		return (Conta)super.findByQuery("SELECT c FROM Conta c WHERE c.id="+c.getId());
	}

}
